package com.itheima.controller;

import com.itheima.commit.R;
import com.itheima.pojo.User;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping("/sendMsg")
    public R<String> send(@RequestBody User user, HttpServletRequest request){
        return userService.send(user,request);
    }
    @PostMapping("/login")
    public R<User> login(@RequestBody Map map , HttpServletRequest request){
        return userService.login(map,request);
    }
}
